// Project: Salient
// http://salient.codeplex.com
// 
// Copyright 2010, Sky Sanders <sky at skysanders.net>
// Dual licensed under the MIT or GPL Version 2 licenses.
// http://salient.codeplex.com/license
// 
// Date: April 25 2010 

#region

using System;
using System.Configuration;

#endregion

namespace Salient.Web.Configuration
{
    ///<summary>
    ///</summary>
    public class AccessControlSection : ConfigurationSection
    {
        private const string EnabledKey = "enabled";
        private const string SetResponseHeaderKey = "setResponseHeader";
        private const string HeaderNameKey = "headerName";
        private const string HeaderDefaultValue = "x-access-control";

        ///<summary>
        ///</summary>
        [ConfigurationProperty(EnabledKey, DefaultValue = false, IsRequired = false)]
        public Boolean Enabled
        {
            get { return (Boolean)this[EnabledKey]; }
            set { this[EnabledKey] = value; }
        }

        /// <summary>
        /// Indicates whether to set a response header containing a JSOB with relevant user/context information
        /// </summary>
        [ConfigurationProperty(SetResponseHeaderKey, DefaultValue = false, IsRequired = false)]
        public Boolean SetResponseHeader
        {
            get { return (Boolean)this[SetResponseHeaderKey]; }
            set { this[SetResponseHeaderKey] = value; }
        }

        /// <summary>
        /// The name of the http header to read/write
        /// </summary>
        [ConfigurationProperty(HeaderNameKey, DefaultValue = HeaderDefaultValue, IsRequired = false)]
        public string HttpHeaderName
        {
            get { return (string)this[HeaderNameKey]; }
            set { this[HeaderNameKey] = value; }
        }
    }

}